package p12.p1226;

public class p1226 {
    public static void main(String[] args) {
        String ss = "woaijavawozhendeaijavaaijava";
        String s = "java";
        System.out.println(getCount(ss,s));
    }

    public static int getCount(String ss, String s) {
        int count = 0;
        //查找第一个s出现的位置。
        int index = ss.indexOf(s);
        //System.out.println("index = " + index);
        while (index != -1) {
                count++;
                int startIndex = index + s.length();
                ss = ss.substring(startIndex);
                index = ss.indexOf(s);
        }
        return count;
    }
}
